Discovery Test #1

This post advertises its Webmention endpoint with an HTTP Link header. The URL is relative, so this will also test whether your discovery code properly resolves the relative URL.

Reacji

The emoji below show Reacji responses, created by people posting a comment linking to this post with an in-reply-to property, whose text is a single emoji character.

Reposts

The profile icons below are the author photos from people who have posted a "repost" of this post on their site, where their post links to this post with the repost-of property.

Bookmarks

The profile icons below are the author photos from people who have posted a bookmark of this post on their site, where their post links to this post with the bookmark-of property.

Comments

The comments below are replies to this post, and marked up their link to the post with the in-reply-to property.

Mentions

The mentions below linked to this post, but did not include this post's URL as an in-reply-to property.

  • No Name
    Comment text not found
    https://www.roughconsensusandrunningcode.net/webmentiontest.html

    The post did not provide a URL, using source instead

  • No Name

    Revisiting Perl Object-Oriented Programming (OOP) in 2025: A Modern Take

    Back in November 2002, I published a blog post titled Camel POOP – Perl Object-Oriented Programming. It was my attempt to demystify Perl’s OOP capabilities for developers who might not have realised just how flexible and powerful the language could be. Fast forward to 2025, and while much has changed in the tech world, Perl still holds its ground as a versatile and reliable programming language. I thought it was about time to revisit that old post, take a fresh look at Perl OOP, and explore how modern practices have shaped the way we write Perl today.

    The Longevity of Perl in 2025

    Perl has a way of surprising people. It’s still actively developed, and its latest version, Perl 5.40.0 (released in 2024), brought some fantastic updates, including native try/catch exception handling and the __CLASS__ keyword. Even as other languages gain popularity, Perl continues to be a go-to tool for text processing, web development, and system administration. Its object-oriented programming features may not be the flashiest, but they remain as practical and flexible as ever.

    What’s New in Perl OOP?

    1. Modern Object Systems: Moo, Moose, and Mo

    If you’ve spent any time in the Perl community recently, you’ve probably heard of Moo, Moose, or even Mo. These lightweight object systems have become the standard for many developers, offering cleaner syntax and more powerful features than Perl’s built-in OOP capabilities.

    For instance, here’s how you’d create a Person class using Moo:

    package Person;
    use Moo;
    
    has 'first_name' => (is => 'rw', required => 1);
    has 'last_name'  => (is => 'rw', required => 1);
    has 'address'    => (is => 'rw');
    
    sub print {
        my $self = shift;
        printf("Name: %s %s\n", $self->first_name, $self->last_name);
    }
    
    1;
    

    Moo automatically generates accessors, handles attribute validation, and makes your code more concise. Compare that to manually defining accessors in my original post—it’s clear how much time and effort you can save with modern tools.

    2. Better Error Handling with try/catch

    Back in 2002, error handling in Perl often involved using eval, which could get messy and hard to read. The addition of native try/catch syntax in Perl 5.40.0 changes that. It’s simple and elegant:

    use feature 'try';
    
    try {
        my $person = Person->new(first_name => 'Khurt', last_name => 'Williams');
        $person->print;
    } catch ($e) {
        warn "An error occurred: $e";
    };
    

    This is a huge improvement for writing more maintainable and readable code.

    3. Inheritance Made Easy with Moo or Moose

    In my original post, I discussed using @ISA for inheritance. While it works, it’s a bit clunky. Modern object systems like Moose make this much smoother. Here’s an example:

    package Employee;
    use Moose;
    extends 'Person';
    
    has 'id'    => (is => 'rw', required => 1);
    has 'title' => (is => 'rw');
    
    around 'print' => sub {
        my ($orig, $self) = @_;
        $self->$orig();
        print "Title: " . $self->title . "\n";
    };
    
    1;
    

    With Moose, you don’t need to worry about manually overriding methods or handling inheritance quirks. It just works, and it works beautifully.

    4. Type Validation with Type::Tiny

    Another modern addition to Perl development is the use of type constraints. Using Type::Tiny, you can ensure your attributes have the correct data types:

    use Types::Standard qw(Str Int);
    
    has 'id'    => (is => 'rw', isa => Int);
    has 'title' => (is => 'rw', isa => Str);
    

    This is incredibly useful for catching errors early and making your code more robust.

    Reflecting on the Basics

    Packages and Namespaces

    The concept of packages hasn’t changed much since 2002, but modern Perl developers often use namespace::autoclean to prevent namespace pollution:

    use namespace::autoclean;
    

    Bless and Raw OOP

    Using bless directly still works and is sometimes useful for quick scripts or minimal dependencies. However, in most cases, modern object systems like Moo or Moose make bless unnecessary for day-to-day development.

    Why Modernise?

    Looking back at my original post, I’m struck by how much of it is still relevant today. Perl’s core OOP features haven’t changed, but the ecosystem around them has evolved dramatically. By adopting modern tools and techniques, you can:
    – Write code that’s easier to read and maintain.
    – Reduce boilerplate and focus on solving real problems.
    – Take advantage of Perl’s latest features for better performance and reliability.

    Bridging the Past and Present

    It’s been fun revisiting my old blog post and reflecting on how far Perl’s OOP capabilities have come. If you’re still using Perl for your projects, I encourage you to explore tools like Moo, Moose, and Type::Tiny. They’ll make your life as a developer so much easier.

    If you’re curious about the basics, feel free to check out my original post. It’s a nice reminder of how Perl OOP works under the hood. And if you’ve got thoughts or questions about modern Perl practices, I’d love to hear from you in the comments below!

    Like this:

    Like Loading...
  • No Name
    Comment text not found
    https://gabriels.cloud/2024/03/02/webmention-test/

    The post did not provide a URL, using source instead

Responses are stored for 48 hours and may be deleted after that time.